<?php
	include '../utils/_connection.php';
	$var = conectar();
	session_start();

	$id = $_POST['id'];

	$sql = "SELECT * FROM authors WHERE id_author='$id'";
	$res = mysql_query($sql);
	$obj = mysql_fetch_object($res);

	if ($_POST['name'] != "")
		$obj->name = $_POST['name'];

	if ($_POST['center'] != "")
		$obj->center = $_POST['center'];

	if ($_POST['degree'] != "")
		$obj->degree = $_POST['degree'];

	if ($_POST['bios'] != "")
		$obj->bios = $_POST['bios'];

	if ($_POST['email'] != "")
		$obj->email = $_POST['email'];

	if ($_POST['pass'] != "")
		$obj->pass = $_POST['pass'];


	$sql = "UPDATE `authors` 
			SET `name`= '$obj->name' ,
				`center`= '$obj->center' ,
				`degree`= '$obj->degree' ,
				`bios`= '$obj->bios' ,
				`email`= '$obj->email' ,
				`pass`= '$obj->pass'
			WHERE id_author='$id' ";

	mysql_query($sql);

	header("Location: /backend/autor/info.php");

?>